package com.fy.dao;

import com.fy.entity.Ac_info;
import com.fy.entity.Fy_info;
import com.fy.entity.Goods;
import com.fy.entity.Search;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SearchMapper {
    @Select("select * from search")
    List<Search> findAll();

    @Select("SELECT * FROM search WHERE info_id=#{info_id} order by s_id DESC")
    List<Search> getInfo(@Param("info_id") String info_id);

    @Insert("insert into search set s_id=#{s_id},info_id=#{info_id},s_info=#{s_info}")
    int insert(@Param("s_id") String s_id, @Param("info_id") String info_id, @Param("s_info") String s_info);

    @Delete("DELETE from search where s_id=#{s_id}")
    int delete(@Param("s_id") String s_id);

    @Select("select * from fy_info where fy_name like CONCAT('%',#{name},'%')")
    List<Fy_info> SearchFyByName(@Param("name") String name);

    @Select("select * from ac_info where ac_title like CONCAT('%',#{name},'%')")
    List<Ac_info> SearchAcByName(@Param("name") String name);

    @Select("select * from goods where goods.go_title like CONCAT('%',#{name},'%')")
    List<Goods> SearchGoByName(@Param("name") String name);

}
